#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtGui>

#include "myButton.h"
//#include "pageTError.h"
//#include "pageloadtest.h"
//#include "pagedatamanage.h"
//#include "serialconnection.h"
//#include "pagehumiture.h"
#include "cttest.h"
#include "bbtest.h"
#include "fhtest.h"
#include "system_setting.h"
#include "equipment.h"

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
//    pageTError *errorTest;
//    pageLoadTest *loadTest;

//    PAGEHUMITURE *humiture;
    CtTest *cttest;
    FhTest *fhtest;
    System_Setting *system_setting;
    BbTest *bbtest;
    Equipment *equipment;

    QPushButton *btnScreenShot;

    enum menuOperation{
            Add,
            Show,
            Delete,
        }myMenuOperation;

    void layoutMainWindow();
    void newFunctionPage(QString name, QWidget* functionPage);
    void sendData(QByteArray sendBuf);

    void updateMenu(menuOperation opt, QString name,int index);
    void addButtonToMenu(QString name);
    void toggleButtonInMenu(int pageIndex);

public:
    QStackedWidget *stackedPage;
    QHBoxLayout *layoutMenuBar;
    QStringList *listFunctionPage;
//    serialConnection *linkToHardware;

private slots:
    void appQuit() {qApp->quit();}
    void switchFunctionPage(QString);
    void takePhoto();
    void readData();
    void sendCmd();
};

#endif // MAINWINDOW_H
